package com.atguigu.education.util;

public class MysqlUtil {
    public static String getTestPaperDDL(){
        return "CREATE TEMPORARY TABLE test_paper (\n" +
                "  `id` string,\n" +
                "  `paper_title` string,\n" +
                "  `course_id` string,\n" +
                "  `create_time` string,\n" +
                "  `update_time` string,\n" +
                "  `publisher_id` string,\n" +
                "  `deleted` string\n" +
                //  "  PRIMARY KEY (id) NOT ENFORCED\n" +
                ") " + getMysqlDDL("test_paper");
    }
    public static String getMysqlDDL(String tableName){
        return "WITH (\n" +
                "  'connector' = 'jdbc',\n" +
                "  'url' = 'jdbc:mysql://hadoop102:3306/edu_group102',\n" +
                "  'username' = 'root',\n" +
                "  'password' = 'group102',\n" +
                "  'driver' = 'com.mysql.cj.jdbc.Driver', \n" +
                //可以设置存活时间进行优化
                "  'lookup.cache.max-rows' = '10',\n" +
                "  'lookup.cache.ttl' = '1 hour',\n" +
                "  'table-name' = '" + tableName + "'\n" +
                ")";
    }
}
